import { Router } from 'hyper-express';
import requireUser from '../../../middlewares/auth/requireUser';
import cache from '../../../middlewares/cache';
import rowLevelPermission from '../../../middlewares/auth/rowLevelPermission';
//#region AutoCreateCode
import { uctooWechatpayTransactionController } from '../../../controllers';
const uctoowechatpayTransactionRouter = new Router();
const wechatpayTransactionController = new uctooWechatpayTransactionController();

uctoowechatpayTransactionRouter.post('/add', requireUser, wechatpayTransactionController.add);
uctoowechatpayTransactionRouter.post('/edit', requireUser, rowLevelPermission('uctoo/wechatpay_transaction'), wechatpayTransactionController.edit);
uctoowechatpayTransactionRouter.post('/del', requireUser, rowLevelPermission('uctoo/wechatpay_transaction'), wechatpayTransactionController.delete);

//For getting wechatpayTransaction with permission control
uctoowechatpayTransactionRouter.get('/:id', requireUser,  rowLevelPermission('uctoo/wechatpay_transaction'), wechatpayTransactionController.getSingle);
uctoowechatpayTransactionRouter.get('/:limit/:page', requireUser,  rowLevelPermission('uctoo/wechatpay_transaction'), wechatpayTransactionController.getMany);
uctoowechatpayTransactionRouter.get('/:limit/:page/:skip', requireUser,  rowLevelPermission('uctoo/wechatpay_transaction'), wechatpayTransactionController.getMany);

//#endregion AutoCreateCode
uctoowechatpayTransactionRouter.post('/payTransactionsH5', wechatpayTransactionController.payTransactionsH5);
uctoowechatpayTransactionRouter.post('/payTransactionsJSAPI', wechatpayTransactionController.payTransactionsJSAPI);
uctoowechatpayTransactionRouter.post('/payBuyJSAPI', wechatpayTransactionController.payBuyJSAPI);
uctoowechatpayTransactionRouter.post('/notify/:appid', wechatpayTransactionController.notify);
uctoowechatpayTransactionRouter.get('/count', wechatpayTransactionController.countTransactions);
export default uctoowechatpayTransactionRouter;
